<%@page import="entity.User"%>
<%@page import="dao.UserDAO,java.util.*"%>
<%@page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<!--自己写的网页，没美工的好看，文件名改为listUser4.jsp即可-->
<html>
	<head>
	<style>
	.red{
		background-color:red;
	}
	.green{
		background-color:green;
	}
	
	</style>
	</head>
	<body style="font-size:30px;">
		<table border="1" cellpadding="0" cellspacing="0">
		<tr>
		<th>ID</th><th>用户名</th><th>邮箱</th><th>电话</th><th>操作</th>
		</tr>
		<%
			UserDAOImpl dao = new UserDAOImpl();
				List<User2> users = dao.findAll();
				int i=0;
				for(User2 user : users ){
			int id = user.getId();
		%>
			<tr class="
			<%=(i++)%2==0?"green":"red" %>
			">
			<th><%=user.getId() %></th>
			<th><%=user.getUsername() %></th>
			<th><%=user.getEmail() %></th>
			<th><%=user.getPhone() %></th>
			<th><a href="delUser4?id=<%=user.getId() %>">删除</a></th>
			</tr>
			<%
		}
		%>
		</table>
	<p><a href='addUser4.html'>添加用户</a></p>
	</body>
</html>